# -*- coding: utf-8 -*- 
# @project : 《Atcoder》
# @Author : created by bensonrachel on 2021/8/18
# @File : TPM（step2）C. Number of Segments with Small Sum.py
def TPM():
    l = 0
    sum = 0
    res = 0
    for r in range(n):
        sum += rate[r]
        while (sum > s):
            sum -= rate[l]
            l += 1
        res += (r - l + 1)
    return res

"""
if the segment [L,R] is good, then any segment nested in it is also good (in this case, 
you can apply the code from the first problem);

枚举r,维护一个最小的l,满足sum[l,r]<=s,
此时[l+1,r],[l+2,r]...[r,r]中,每个区间的和一定也是<=s的,
满足条件的左端点取值范围为[l,r],一共r-l+1个,因此答案累加r-l+1.

显然l的移动是向右单调的.

"""
if __name__ == "__main__":
    n, s = map(int, input().split())
    rate = [int(i) for i in input().split()]
    print(TPM())

